package com.hopu.oa.service.impl.process;


import com.hopu.oa.dao.process.NewProcessDao2;
import com.hopu.oa.entity.management.AoaTypeList;
import com.hopu.oa.entity.process.*;
import com.hopu.oa.entity.user.AoaUser;
import com.hopu.oa.service.process.NewProcessService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName: NewProcessServiceImp2
 * @Description:
 * @Date: 2021/11/22 19:25
 */
@Service
public class NewProcessServiceImp2 implements NewProcessService2 {

    @Autowired
    private NewProcessDao2 newProcessDao2;


    @Override
    public List<AoaTypeList> queryType(String key) {
        int array[] = null;


        if (key.equals("紧急程度")) {
            array = new int[]{22, 23, 24};
        }
        if (key.equals("请假")) {
            array = new int[]{37, 38, 39, 40, 41, 42, 43};
        }
        if (key.equals("加班")) {
            array = new int[]{33, 34, 35, 36};
        }
        if (key.equals("出差")) {
            array = new int[]{28, 29, 30, 31, 32};
        }
        if (key.equals("报销")) {
            array = new int[]{25, 26, 27};
        }


        return newProcessDao2.queryType(array);
    }


    /*
      @Description : 通讯录
      @Date   :  2021/11/22
      @Param  : [userName, index, size]
      @return : java.util.List<com.hopu.oa.entity.user.AoaUser>
     */
    @Override
    public List<AoaUser> findUserInfo(String baseKey, int index, int size) {
        return newProcessDao2.findUserInfo(baseKey, index, size);
    }

    /*
      @Description : 查询部门与职位
      @Date   :  2021/11/22
      @Param  : []
      @return : java.util.Map<java.lang.String,java.lang.Object>
     */
    @Override
    public Map<String, Object> queryDeptAndPosition() {
        Map<String, Object> map = new HashMap<String, Object>();
        //部门
        map.put("dept", newProcessDao2.queryDept());
        //职位
        map.put("position", newProcessDao2.queryPosition());
        return map;
    }


    /*
      @Description : 添加process
      @Date   :  2021/11/23
      @Param  : [process]
      @return : int
     */
    @Override
    public int insertProcess(AoaProcessList process) {
        return newProcessDao2.insertProcess(process);
    }


    /*
      @Description : 转正表
      @Date   :  2021/11/23
      @Param  : [regular]
      @return : int
     */
    @Override
    public int insertRegular(AoaRegular regular) {
        return newProcessDao2.insertRegular(regular);
    }

    @Override
    public int insertProcess_holiday(AoaProcessList process) {
        return newProcessDao2.insertProcess_holiday(process);
    }


    /*
      @Description : 请假
      @Date   :  2021/11/23
      @Param  : [holiday]
      @return : int
     */
    @Override
    public int insertHoliday(AoaHoliday holiday) {
        return newProcessDao2.inserHoliday(holiday);
    }


    /*
      @Description : 辞职
      @Date   :  2021/11/23
      @Param  : [process]
      @return : int
     */
    @Override
    public int insertProcess_resign(AoaProcessList process) {
        //return newProcessDao2.insertProcess_resign(process);
        return newProcessDao2.insertProcess(process);
    }


    /*
      @Description : 离职交接用户id
      @Date   :  2021/11/23
      @Param  : [handuser]
      @return : int
     */
    @Override
    public int queryUserIdByName(String handuser) {
        return newProcessDao2.queryUserIdByName(handuser);

    }


    /*
      @Description : 离职
      @Date   :  2021/11/23
      @Param  : [resign]
      @return : int
     */
    @Override
    public int insertResign(AoaResign resign) {
        return newProcessDao2.insertResign(resign);
    }

    @Override
    public int inertAttachment(AoaAttachmentList attachment) {
        return newProcessDao2.inertAttachment(attachment);
    }

    /*
      @Description : 加班
      @Date   :  2021/11/23
      @Param  : [overtime]
      @return : void
     */
    @Override
    public int insertOvertime(AoaOvertime overtime) {
        return newProcessDao2.insertOvertime(overtime);
    }


    /*
      @Description : 出差
      @Date   :  2021/11/23
      @Param  : [evection]
      @return : int
     */
    @Override
    public int insertEvection(AoaEvection evection) {
        return newProcessDao2.insertEvection(evection);
    }


    /*
      @Description : 费用科目
      @Date   :  2021/11/23
      @Param  : []
      @return : java.util.List<com.hopu.oa.entity.process.AoaSubject>
     */
    @Override
    public List<AoaSubject> querySubject() {
        return newProcessDao2.querySubject();
    }

    /*
      @Description : 报销
      @Date   :  2021/11/24
      @Param  : [bursement]
      @return : int
     */
    @Override
    public int inertBursement(AoaBursement bursement) {
        return newProcessDao2.inertBursement(bursement);
    }


    /*
      @Description : Reviewed
      @Date   :  2021/11/24
      @Param  : [reviewed]
      @return : int
     */
    @Override
    public int insertReviewed(AoaReviewed reviewed) {
        return newProcessDao2.insertReviewed(reviewed);
    }

    @Override
    public int insertDetails(Details details) {
        return newProcessDao2.insertDetails(details);
    }

}
